<template>
  <div></div>
</template>
<script setup>
import { useRoute, useRouter } from "vue-router";
import store from "@/store";
import { ElMessage } from "element-plus";
const route = useRoute();
const router = useRouter();
//query
const clientId = route.query.clientId;
if (clientId) {
  let parmars = {
    clientId,
  };
  store.userStore
    .oauthLogin(parmars)
    .then((res) => {
      if (res.success) {
        console.log("------oauthLoginSuccess-------");
        router.push({ path: "/Home" });
      } else {
        router.push({ path: "/login" });
        ElMessage.error(res.msg || "登录出错，请重试");
      }
    })
    .catch((err) => {
      router.push({ path: "/login" });
      ElMessage.error(err.msg || "登录出错，请重试");
    });
} else {
  router.push({ path: "/login" });
}
</script>
<style>
</style>